
<template>
  <div>
      <el-button type="primary" :icon="Edit" @click="login">登录</el-button>
      <el-button type="success" :icon="Check" @click="userList">用户信息</el-button>
    </div>

</template>

<script setup>
   import request from '@/util/request'
   import store from '@/store'

   // 登录后，要将token存储起来
   const login = async () => {
      let result = await request.get('/test/user/login',{})
      if(result.code == '0'){
          console.log(result.data)
          store.commit('SET_TOKEN',result.data)
          console.log("登录成功")
      }else{
          console.log(result.msg)
      }
   }

   // 用户列表
   const userList = async () => {
       let result = await request.get('/test/user/sysList',{})
       if(result.code == '0'){
           console.log(result.data)
       }else{
           console.log(result.msg)}
       }


</script>

<style></style>
